const resolve = dir => require("path").join(__dirname, dir);
const path = require('path')
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
  lintOnSave: true,
  productionSourceMap: false,
  configureWebpack() {
    let config = {
      plugins: [
        new CopyWebpackPlugin([
          {
            from: './*',
            to: path.join(__dirname, './publish/'),
            ignore: ['package-lock.json']
          }
        ])
      ],
      externals: process.env.NODE_ENV === 'production' ?
      {
        'vue': 'vue',
        'element-ui': 'element-ui',
        'lodash': 'lodash'
      } : {}
    }
    return config;
  },
  chainWebpack: config => {
    config.plugins.delete("prefetch").delete("preload");
    config.resolve.symlinks(true);
    // 重新设置 alias
    config.resolve.alias.set("~", resolve("public")).end();
  }
};